import React, { useState } from 'react';
import { ImageUploader, ImageUploadItem, Input } from 'antd-mobile';
import { PictureOutline} from 'antd-mobile-icons';
import './ChatAction.scss';

const ChatAction = () => {
  // 图片列表
  const [fileList, setFileList] = useState<ImageUploadItem[]>([]);

  /**
   *@description 已上传的文件列表变化时触发的回调函数
   * */
  const onChangeFieList = (uploads: ImageUploadItem[]) => {
    setFileList(uploads);
  };


  /**
   * @description上传的回调函数，入参是需要被上传的文件对象，经过异步处理之后，返回上传结果
   * */
  const onUpload = async (file: File) => {
    return {
      url: '',
    };
  };


  return (
    <div className="chat-action">
      <Input style={{ '--font-size': '14px' }} type="text" placeholder="问医生"></Input>
      <ImageUploader value={fileList} onChange={onChangeFieList} upload={onUpload}>
        <PictureOutline fontSize={20}></PictureOutline>
      </ImageUploader>
    </div>
  );
};

export default ChatAction;